{extend name="adminblue/base" /}
{block name="main"}
<div class="set-style">
	<dl>
		<dt>店铺等级：</dt>
		<dd>
			<p>{$shop_info['instance_type_info']['type_name']}</p>
		</dd>
	</dl>
	<dl>
		<dt>店铺名称：</dt>
		<dd>
			<p>{$shop_info['base_info']['shop_name']}</p>
		</dd>
	</dl>
	<dl>
		<dt>店铺类型：</dt>
		<dd>
			<p>{$shop_info['group_info']['group_name']}</p>
		</dd>
	</dl>
	<dl>
		<dt>网站logo：</dt>
		<dd>
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadImg" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden"id="logo"value="{$shop_info['base_info']['shop_logo']}"/>
				</div>
				<input type="text" id="text_logo" class="input-common" readonly="readonly" value="{$shop_info['base_info']['shop_logo']}" />
				<em>上传</em>
				
				<img id="preview_logo" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$shop_info['base_info']['shop_logo']"}data-src="{:__IMG($shop_info['base_info']['shop_logo'])}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			<p class="hint">
				<span>建议使用<i class="important-note">宽600</i>像素-<i class="important-note">高60</i>像素内的<i class="important-note">GIF</i>或<i class="important-note">PNG</i>透明图片</span>
			</p>
		</dd>
	</dl>
	
	<dl>
		<dt>横幅：</dt>
		<dd>
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadBanner" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden"id="banner"value="{$shop_info['base_info']['shop_banner']}"/>
				</div>
				<input type="text" id="text_banner" class="input-common" readonly="readonly" value="{$shop_info['base_info']['shop_banner']}" />
				<em>上传</em>
				
				<img id="preview_banner" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$shop_info['base_info']['shop_banner']"}data-src="{:__IMG($shop_info['base_info']['shop_banner'])}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			<p class="hint">
				<span>建议使用<i class="important-note">宽600</i>像素-<i class="important-note">高60</i>像素内的<i class="important-note">GIF</i>或<i class="important-note">PNG</i>透明图片</span>
			</p>
		</dd>
	</dl>
	
	<dl>
		<dt>店铺头像：</dt>
		<dd>
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadAvatar" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden"id="avatar"value="{$shop_info['base_info']['shop_avatar']}"/>
				</div>
				<input type="text" id="text_avatar" class="input-common" readonly="readonly" value="{$shop_info['base_info']['shop_avatar']}" />
				<em>上传</em>
				
				<img id="preview_avatar" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$shop_info['base_info']['shop_avatar']"}data-src="{:__IMG($shop_info['base_info']['shop_avatar'])}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			<p class="hint">
				<span>建议使用<i class="important-note">宽600</i>像素-<i class="important-note">高60</i>像素内的<i class="important-note">GIF</i>或<i class="important-note">PNG</i>透明图片</span>
			</p>
		</dd>
	</dl>

	<dl>
		<dt>店铺背景：</dt>
		<dd>
			<div class="upload-btn-common">
				<div>
					<input class="input-file" name="file_upload" id="uploadBg" type="file" onchange="imgUpload(this);" title="上传">
					<input type="hidden"id="bg"value="{$shop_info['base_info']['shop_bg']}"/>
				</div>
				<input type="text" id="text_bg" class="input-common" readonly="readonly" value="{$shop_info['base_info']['shop_bg']}" />
				<em>上传</em>

				<img id="preview_bg" src="__STATIC__/blue/img/upload-common-select.png" {if condition="$shop_info['base_info']['shop_bg']"}data-src="{:__IMG($shop_info['base_info']['shop_bg'])}"{/if} data-html="true" data-container="body" data-placement="top" data-trigger="manual"/>

			</div>
			<p class="hint">
				<span>建议使用<i class="important-note">宽600</i>像素-<i class="important-note">高60</i>像素内的<i class="important-note">GIF</i>或<i class="important-note">PNG</i>透明图片</span>
			</p>
		</dd>
	</dl>


	<dl>
		<dt>QQ：</dt>
		<dd>
			<p><input id="shop_qq" type="text" value="{$shop_info['base_info']['shop_qq']}" class="input-common"></p>
			<p class="error">请输入qq</p>
		</dd>
	</dl>
	<dl>
		<dt>阿里旺旺：</dt>
		<dd>
			<p><input id="shop_ww" type="text" value="{$shop_info['base_info']['shop_ww']}" class="input-common"></p>
			<p class="error">请输入阿里旺旺</p>
		</dd>
	</dl>
	<dl>
		<dt>商家电话：</dt>
		<dd>
			<p><input id="shop_phone" type="text" value="{$shop_info['base_info']['shop_phone']}" class="input-common"></p>
			<p class="error">请输入商家电话</p>
		</dd>
	</dl>
	<dl>
		<dt>店铺公告：</dt>
		<dd>
			<p><input id="shop_notice" type="text" value="{$shop_info['base_info']['shop_notice']}" class="input-common"></p>
			<p class="error">请输入店铺公告</p>
		</dd>
	</dl>
	<dl>
		<dt>seo关键字：</dt>
		<dd>
			<p><input id="shop_keywords" type="text" value="{$shop_info['base_info']['shop_keywords']}" class="input-common"></p>
			<p class="error">请输入seo关键字</p>
		</dd>
	</dl>

	<dl>
		<dt>seo描述：</dt>
		<dd>
			<p><textarea id="shop_description">{$shop_info['base_info']['shop_description']}</textarea> </p>
			<p class="error">请输入seo描述</p>
		</dd>
	</dl>
	<dl>
		<dt></dt>
		<dd><button class="btn-common btn-big" onclick="setShopConfigAjax();">提交</button></dd>
	</dl>
</div>
<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>
function setShopConfigAjax(){
	var shop_logo = $("#logo").val();
	var shop_banner = $("#banner").val();
	var shop_avatar = $("#avatar").val();
	var shop_qq = $("#shop_qq").val();
	var shop_ww = $("#shop_ww").val();
	var shop_phone = $("#shop_phone").val();
	var shop_keywords = $("#shop_keywords").val();
	var shop_description = $("#shop_description").val();
	var shop_bg = $("#bg").val();
	var shop_notice = $("#shop_notice").val();
	$.ajax({
		type:"post",
		url:"{:__URL('ADMIN_MAIN/Shop/shopConfig')}",
		data:{
			'shop_logo':shop_logo,
			'shop_banner':shop_banner,
			'shop_avatar':shop_avatar,
			'shop_qq':shop_qq,
			'shop_ww':shop_ww,
			'shop_phone':shop_phone,
			'shop_keywords':shop_keywords,
			'shop_description':shop_description,
			'shop_bg':shop_bg,
			'shop_notice':shop_notice
		},
		success:function (data) {
			if (data["code"] > 0) {
				showMessage('success', data["message"],"{:__URL('ADMIN_MAIN/Shop/shopConfig')}");
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}

//图片上传
function imgUpload(event) {
	var fileid = $(event).attr("id");
	var data = { 'file_path' : UPLOADCOMMON };
	var id = $(event).next().attr("id");
	uploadFile(fileid,data,function(res){
		if(res.code){
			$("#"+id).val(res.data);
			$("#text_" + id).val(res.data);
			$("#preview_" + id).attr("data-src",__IMG(res.data));
			showTip(res.message,"success");
		}else{
			showTip(res.message,"error");
		}
	});
}
</script>
{/block}